/**
 * @author lulongwen
 * Date: 2023-08-30 22:38
 * Description: Triangle，三角形
 */

export function Triangle(props: any) {
  const { width, height } = props;

  const cx = width / 2;

  // 'M0,70 L50,0 L100,70 z'
  const path = [
    ['M0', height], // M0,70
    [`L${cx}`, 0], // L50,0
    [`L${width}`, height], // L100,70
    ['z'],
  ]
    .map(item => item.join(','))
    .join(' ');

  return (
    <svg
      xmlns='http://www.w3.org/2000/svg'
      width={width}
      height={height}
      className='block'
    >
      <path
        d={path}
        // d='M0,70 L50,0 L100,70 z'
        fill='#ff6700'
        strokeWidth='0'
        stroke='#fff'
      />
    </svg>
  );
}
